package users

import (
	"errors"
)

// 检测用户名是否存在
//
//	name	用户名
//	uid		用户ID(忽略当前用户的id)
func CheckUserName(name string, uid uint) error {
	uids, err := GetId(name)
	if err != nil {
		return err
	}
	if uids > 0 && uids != uid {
		return errors.New("用户名已存在")
	}
	return nil
}
